package hiho.ku._1049;

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String pre = in.next();
		String mid = in.next();
		find(pre, mid);
		System.out.println();
	}
	
	private static void find(String pre, String mid) {
		int r = mid.indexOf(pre.charAt(0));
		if (r > 0)
			find(pre.substring(1, r + 1), mid.substring(0, r));
		if (r < mid.length() - 1)
			find(pre.substring(r + 1), mid.substring(r + 1));
		System.out.print(pre.charAt(0));
	}

}
